package com.gridmobi.xrtb.handler.monitor;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

public class RtbStatus {

    public static AtomicBoolean DEBUG_LOG = new AtomicBoolean(false);

    public static AtomicBoolean RELEASE_LOCK = new AtomicBoolean(false);
    public static boolean BID_LOCK = false;
    public static boolean BID_LOCK_BY_BUDGET_ERROR = false;
    public static boolean BID_LOCK_BY_CLICKS_ERROR = false;
    public static boolean BID_LOCK_BY_WINNOTICE_ERROR = false;



    /**
     * 初始化完成 状态设置true
     */
    public static AtomicBoolean INDEX_INIT_FINISHED = new AtomicBoolean(false);

    /**
     * 当实时同步数据 异常次数达到阈值时候 设置true,避免脏数据 停止系统运行
     */
    public static AtomicInteger ERROR_TIMES = new AtomicInteger(0);

    public static AtomicBoolean DATA_SYNCH_ERROR_STATUS = new AtomicBoolean(false);

    public static void errorCounter() {
        if (ERROR_TIMES.addAndGet(1) >= 10000) {
            RtbStatus.DATA_SYNCH_ERROR_STATUS.set(true);
        }
    }



}
